module.exports = (app) => {
  app.all('*', (req, res, next) => {
    res.header('Access-Control-Allow-Origin', 'http://localhost:8080');
    res.header('Access-Control-Allow-Headers', 'Content-Type,Content-Length, Authorization, Accept,X-Requested-With');
    res.header('Access-Control-Allow-Credentials', true);
    if (req.method == 'OPTIONS') {
      res.send(200);
    } else {
      next();
    }
  });
  app.get('/', (req, res) => {
    res.json({ message: 'Hello index' });
  });
  app.use('/api/v1', require('./users'));
  app.use('/api/admin', require('./admin'));
};
